
<?php 
 require_once("php_connect.php");
 $connexion = new PDO('mysql:host='.$PARAM_hote.';dbname='.$PARAM_nom_bd, $PARAM_utilisateur, $PARAM_mot_passe,array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
 $sql="SELECT * FROM test_anim NATURAL JOIN adresse_anim ORDER BY nom ";
 $regexp = "/^id/";
$query = $connexion->query($sql);
$tab_resul = array();
$nb_col = $query->columnCount();
echo "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"display\" id=\"table_recherche\">
	<thead>
		<tr>";
	
			for ($i=0; $i<$nb_col; $i++){
				$meta = $query->getColumnMeta($i); 
				if(!preg_match($regexp,$meta['name']))
					echo '<th>'.$meta['name'].'</th>';
			}
	echo " </tr>
	</thead>
	<tbody>";
	foreach($query as $row){
	echo "<tr class='gradeA' id='".$row['id_anim']."'>";
	for ($i=0; $i<$nb_col; $i++){
				$meta = $query->getColumnMeta($i); 
				if(!preg_match($regexp,$meta['name']))
					echo "<td>". $row[$meta['name']]."</td>";
			}
	echo "</tr>";
	}	
	echo "</tbody>
	<tfoot>
		<tr>";
			for ($i=0; $i<$nb_col; $i++){
				$meta = $query->getColumnMeta($i); 
				if(!preg_match($regexp,$meta['name']))
				echo "<th><input type=\"text\" name=\"search_".$meta['name']."\" value=\"Recherche ".$meta['name']."\" class=\"search_init\" /></th>";
			}
		echo "</tr>
	</tfoot>
</table>";


?>